package org.openmore.consumer.entity.enums;

import org.openmore.common.enums.BaseEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 支付类型
 */
public enum PlatformType implements BaseEnum<PlatformType, String> {
    ALIPAY("ALIPAY", "支付宝支付"),
    WECHAT_PAY("WECHAT_PAY", "微信支付"),
    WECHAT_OPEN("WECHAT_OPEN", "微信开放平台"),
    WECHAT_OPEN_PAD("WECHAT_OPEN_PAD", "微信开放平台PAD适配"),
    WECHAT_MP("WECHAT_MP", "微信公众平台"),
    WECHAT_MINIAPP("WECHAT_MINIAPP", "微信小程序"),
    IAP("IAP", "苹果IAP支付");

    private String value;
    private String displayName;

    static Map<String, PlatformType> enumMap = new HashMap<String, PlatformType>();

    static {
        for (PlatformType type : PlatformType.values()) {
            enumMap.put(type.getValue(), type);
        }
    }

    private PlatformType(String value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }

    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String getDisplayName() {
        return this.displayName;
    }

    public static PlatformType getEnum(String value) {
        return enumMap.get(value);
    }
}
